package com.hfkh.java65;


import java.util.Scanner;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class MyTime {
    private int hour;
    private int minute;
    private int second;

    public MyTime(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    public void display(MyTime time) {
        System.out.println(time.getHour() + ":" + time.getMinute() + ":" + time.getSecond());
    }


    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getMinute() {
        return minute;
    }

    public void setMinute(int minute) {
        this.minute = minute;
    }

    public int getSecond() {
        return second;
    }

    public void setSecond(int second) {
        this.second = second;
    }

    public void addSecond(int sec) {
        this.second = second + sec;
    }

    public void subSecond(int sec) {
        this.second = second - sec;
    }

    public void addMinute(int min) {
        this.minute = minute + min;
    }

    public void subMinute(int min) {
        this.minute = minute - min;
    }

    public void addHour(int hou) {
        this.hour = hour + hou;
    }

    public void subHour(int hou) {
        this.hour = hour - hou;
    }

    public static void main(String[] args) {
        MyTime time = new MyTime(12, 20, 30);
        time.display(time);
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入时的增加量：");
        int hou = sc.nextInt();
        System.out.print("请输入分的增加量：");
        int min = sc.nextInt();
        System.out.print("请输入秒的增加量：");
        int sec = sc.nextInt();
        time.addHour(hou);
        time.addMinute(min);
        time.addSecond(sec);
        time.display(time);

        time.subHour(6);
        time.subMinute(10);
        time.subSecond(11);
        time.display(time);

    }
}
